package com.peza.bikelog.common.domain;

import java.io.Serializable;
import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
public class LogEntry implements Serializable{

	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private long id;
	
	@Temporal (TemporalType.DATE)
	private Calendar date;
	
	@Embedded
	private CourseData course;
	
	@Embedded
	private SpeedData speed;
	
	@Embedded
	private FitnessData fitnessData;
	
	@Enumerated (EnumType.STRING)
	private Bike bike;
	
	@Column (name="COMMENTS")
	private String comments;
	
	@Column (name="DESCRIPTION")
	private String description;
	
	@Column (name="POLAR")
	private String polarFile;
	
	@Column (name="VISIBLE")
	private Boolean visible = true;
	
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Calendar getDate() {
		return date;
	}

	public void setDate(Calendar date) {
		this.date = date;
	}

	public CourseData getCourse() {
		return course;
	}

	public void setCourse(CourseData course) {
		this.course = course;
	}

	public SpeedData getSpeed() {
		return speed;
	}

	public void setSpeed(SpeedData speed) {
		this.speed = speed;
	}

	public Bike getBike() {
		return bike;
	}

	public void setBike(Bike bike) {
		this.bike = bike;
	}

	public FitnessData getFitnessData() {
		return fitnessData;
	}

	public void setFitnessData(FitnessData fitnessData) {
		this.fitnessData = fitnessData;
	}

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getPolarFile() {
		return polarFile;
	}

	public void setPolarFile(String polarFile) {
		this.polarFile = polarFile;
	}


	public Boolean getVisible() {
		return visible;
	}

	public void setVisible(Boolean visible) {
		this.visible = visible;
	}

	@SuppressWarnings("deprecation")
	@Override
	public String toString() {
		return "LogEntry [id=" + id + ", date=" + date.getTime().toLocaleString() + ", course=" + course
				+ ", speed=" + speed + ", fitnessData=" + fitnessData
				+ ", bike=" + bike + ", comments=" + comments
				+ ", description=" + description + ", polarFile=" + polarFile
				+ "]";
	}
	

}
